package o;

import android.content.Context;
import android.os.Bundle;
import com.huawei.cloudservice.CloudAccount;
import com.huawei.cloudservice.CloudAccountManager;
import com.huawei.cloudservice.LoginHandler;
import com.huawei.hwid.core.helper.handler.ErrorStatus;
import com.huawei.secure.android.common.intent.SafeBundle;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class eos {
    private static final Map<String, LoginHandler> ˋ = new ConcurrentHashMap();
    private static CloudAccount ˎ;
    private static final LoginHandler ˏ = new b();

    static class b extends eow {
        private b() {
        }

        public void onLogin(CloudAccount[] cloudAccountArr, int i) {
            Logger.ˎ("WiseDistCloudAccount", "onLogin " + i);
            if (cloudAccountArr != null && i >= 0 && cloudAccountArr.length > i) {
                CloudAccount cloudAccount = cloudAccountArr[i];
                if (cloudAccount != null) {
                    eos.ˎ = cloudAccount;
                }
            }
            for (LoginHandler onLogin : eos.ˋ.values()) {
                onLogin.onLogin(cloudAccountArr, i);
            }
        }

        public void onLogout(CloudAccount[] cloudAccountArr, int i) {
            Logger.ˎ("WiseDistCloudAccount", "onLogout " + i);
        }

        public void onFinish(CloudAccount[] cloudAccountArr) {
            Logger.ˎ("WiseDistCloudAccount", "onFinish");
            for (LoginHandler onFinish : eos.ˋ.values()) {
                onFinish.onFinish(cloudAccountArr);
            }
        }

        protected String ˊ() {
            return "getAccountsByType";
        }

        public void onError(ErrorStatus errorStatus) {
            Logger.ˎ("WiseDistCloudAccount", "onError errorStatus=" + errorStatus.toString());
            super.onError(errorStatus);
            for (LoginHandler onError : eos.ˋ.values()) {
                onError.onError(errorStatus);
            }
        }
    }

    public static CloudAccount ˊ() {
        return ˎ;
    }

    public static void ˎ(String str) {
        ˋ.remove(str);
    }

    public static void ˎ(Context context, Bundle bundle, eow o_eow, String str) {
        ˋ.put(str, o_eow);
        CloudAccountManager.getAccountsByType(context, ContentManager.getInstant().getContext().getPackageName(), bundle, ˏ);
    }

    public static boolean ˏ(Context context) {
        return AccountLoginChecker.ˏ().ॱ(context);
    }

    public static String ˏ() {
        String str = "";
        CloudAccount ˊ = ˊ();
        if (ˊ != null) {
            return new SafeBundle(ˊ.getAccountInfo()).getString("serviceCountryCode");
        }
        return str;
    }
}
